<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="bayi" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{bayiHome.managed ? 'Edit' : 'Add'} Bayi</f:facet>


            <s:decorate id="idField" template="layout/edit.xhtml">
                <ui:define name="label">Id</ui:define>
                <h:inputText id="id"
                       required="true"
                          value="#{bayiHome.instance.id}"
                           size="26">
                    <a:support event="onblur" reRender="idField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>





            <s:decorate id="unvanField" template="layout/edit.xhtml">
                <ui:define name="label">Unvan</ui:define>
                <h:inputTextarea id="unvan"
                               cols="80"
                               rows="3"
                              value="#{bayiHome.instance.unvan}"/>
            </s:decorate>


            <s:decorate id="bayiKoduField" template="layout/edit.xhtml">
                <ui:define name="label">Bayi kodu</ui:define>
                <h:inputText id="bayiKodu"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.bayiKodu}">
                    <a:support event="onblur" reRender="bayiKoduField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="musteridekiKoduField" template="layout/edit.xhtml">
                <ui:define name="label">Musterideki kodu</ui:define>
                <h:inputText id="musteridekiKodu"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.musteridekiKodu}">
                    <a:support event="onblur" reRender="musteridekiKoduField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="binaAdiField" template="layout/edit.xhtml">
                <ui:define name="label">Bina adi</ui:define>
                <h:inputText id="binaAdi"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.binaAdi}">
                    <a:support event="onblur" reRender="binaAdiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="binaNoField" template="layout/edit.xhtml">
                <ui:define name="label">Bina no</ui:define>
                <h:inputText id="binaNo"
                           size="10"
                      maxlength="10"
                          value="#{bayiHome.instance.binaNo}">
                    <a:support event="onblur" reRender="binaNoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="caddeField" template="layout/edit.xhtml">
                <ui:define name="label">Cadde</ui:define>
                <h:inputText id="cadde"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.cadde}">
                    <a:support event="onblur" reRender="caddeField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="daireNoField" template="layout/edit.xhtml">
                <ui:define name="label">Daire no</ui:define>
                <h:inputText id="daireNo"
                           size="10"
                      maxlength="10"
                          value="#{bayiHome.instance.daireNo}">
                    <a:support event="onblur" reRender="daireNoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="iptalField" template="layout/edit.xhtml">
                <ui:define name="label">Iptal</ui:define>
                <h:inputText id="iptal"
                          value="#{bayiHome.instance.iptal}">
                    <a:support event="onblur" reRender="iptalField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="katNoField" template="layout/edit.xhtml">
                <ui:define name="label">Kat no</ui:define>
                <h:inputText id="katNo"
                           size="10"
                      maxlength="10"
                          value="#{bayiHome.instance.katNo}">
                    <a:support event="onblur" reRender="katNoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="postaKoduField" template="layout/edit.xhtml">
                <ui:define name="label">Posta kodu</ui:define>
                <h:inputText id="postaKodu"
                           size="10"
                      maxlength="10"
                          value="#{bayiHome.instance.postaKodu}">
                    <a:support event="onblur" reRender="postaKoduField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="sokakField" template="layout/edit.xhtml">
                <ui:define name="label">Sokak</ui:define>
                <h:inputText id="sokak"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.sokak}">
                    <a:support event="onblur" reRender="sokakField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="ticariUnvanField" template="layout/edit.xhtml">
                <ui:define name="label">Ticari unvan</ui:define>
                <h:inputTextarea id="ticariUnvan"
                               cols="80"
                               rows="3"
                              value="#{bayiHome.instance.ticariUnvan}"/>
            </s:decorate>


            <s:decorate id="ilceEskiAdiField" template="layout/edit.xhtml">
                <ui:define name="label">Ilce eski adi</ui:define>
                <h:inputText id="ilceEskiAdi"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.ilceEskiAdi}">
                    <a:support event="onblur" reRender="ilceEskiAdiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="semtAdiEskiField" template="layout/edit.xhtml">
                <ui:define name="label">Semt adi eski</ui:define>
                <h:inputText id="semtAdiEski"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.semtAdiEski}">
                    <a:support event="onblur" reRender="semtAdiEskiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="adresEskiField" template="layout/edit.xhtml">
                <ui:define name="label">Adres eski</ui:define>
                <h:inputTextarea id="adresEski"
                               cols="80"
                               rows="3"
                              value="#{bayiHome.instance.adresEski}"/>
            </s:decorate>


            <s:decorate id="bayiTipiEskiField" template="layout/edit.xhtml">
                <ui:define name="label">Bayi tipi eski</ui:define>
                <h:inputText id="bayiTipiEski"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.bayiTipiEski}">
                    <a:support event="onblur" reRender="bayiTipiEskiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="kullaniciKoduEskiField" template="layout/edit.xhtml">
                <ui:define name="label">Kullanici kodu eski</ui:define>
                <h:inputText id="kullaniciKoduEski"
                           size="50"
                      maxlength="50"
                          value="#{bayiHome.instance.kullaniciKoduEski}">
                    <a:support event="onblur" reRender="kullaniciKoduEskiField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{bayiHome.persist}"
                       disabled="#{!bayiHome.wired}"
                       rendered="#{!bayiHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{bayiHome.update}"
                       rendered="#{bayiHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{bayiHome.remove}"
                      immediate="true"
                       rendered="#{bayiHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Bayi.xhtml"
                rendered="#{bayiHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty bayiFrom ? 'BayiList' : bayiFrom}.xhtml"
                rendered="#{!bayiHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Ilce">
    <div class="association" id="ilceParent">

        <h:outputText value="There is no ilce associated with this bayi."
                   rendered="#{bayiHome.instance.ilce == null}"/>

        <rich:dataTable var="_ilce"
                   value="#{bayiHome.instance.ilce}"
                rendered="#{bayiHome.instance.ilce != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="ilceTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_ilce.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Iller id</f:facet>
                <h:outputText value="#{_ilce.iller.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ilce adi</f:facet>
                <h:outputText value="#{_ilce.ilceAdi}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{bayiHome.instance.ilce != null ? 'changeParent' : 'selectParent'}" value="#{bayiHome.instance.ilce != null ? 'Change' : 'Select'} ilce"
                       view="/IlceList.xhtml">
                <f:param name="from" value="BayiEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Semtler">
    <div class="association" id="semtlerParent">

        <h:outputText value="There is no semtler associated with this bayi."
                   rendered="#{bayiHome.instance.semtler == null}"/>

        <rich:dataTable var="_semtler"
                   value="#{bayiHome.instance.semtler}"
                rendered="#{bayiHome.instance.semtler != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="semtlerTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_semtler.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ilce id</f:facet>
                <h:outputText value="#{_semtler.ilce.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Semt adi</f:facet>
                <h:outputText value="#{_semtler.semtAdi}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{bayiHome.instance.semtler != null ? 'changeParent' : 'selectParent'}" value="#{bayiHome.instance.semtler != null ? 'Change' : 'Select'} semtler"
                       view="/SemtlerList.xhtml">
                <f:param name="from" value="BayiEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Iller">
    <div class="association" id="illerParent">

        <h:outputText value="There is no iller associated with this bayi."
                   rendered="#{bayiHome.instance.iller == null}"/>

        <rich:dataTable var="_iller"
                   value="#{bayiHome.instance.iller}"
                rendered="#{bayiHome.instance.iller != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="illerTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_iller.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Bolge id</f:facet>
                <h:outputText value="#{_iller.bolge.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Ulke id</f:facet>
                <h:outputText value="#{_iller.ulke.id}">
                    <f:convertNumber/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Il adi</f:facet>
                <h:outputText value="#{_iller.ilAdi}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Plaka kodu</f:facet>
                <h:outputText value="#{_iller.plakaKodu}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{bayiHome.instance.iller != null ? 'changeParent' : 'selectParent'}" value="#{bayiHome.instance.iller != null ? 'Change' : 'Select'} iller"
                       view="/IllerList.xhtml">
                <f:param name="from" value="BayiEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Bayi gpses">
        <h:form styleClass="association" id="bayiGpsesChildren">

            <h:outputText value="There are no bayiGpses associated with this bayi."
                       rendered="#{empty bayiHome.bayiGpses}"/>

            <rich:dataTable value="#{bayiHome.bayiGpses}"
                           var="_bayiGps"
                      rendered="#{not empty bayiHome.bayiGpses}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="bayiGpsesTable">
                <rich:column sortBy="#{_bayiGps.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_bayiGps.id}">
                        <f:convertNumber/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_bayiGps.latitude}">
                    <f:facet name="header">Latitude</f:facet>
                    <h:outputText value="#{_bayiGps.latitude}"/>
                </rich:column>
                <rich:column sortBy="#{_bayiGps.longitude}">
                    <f:facet name="header">Longitude</f:facet>
                    <h:outputText value="#{_bayiGps.longitude}"/>
                </rich:column>
                <rich:column sortBy="#{_bayiGps.type}">
                    <f:facet name="header">Type</f:facet>
                    <h:outputText value="#{_bayiGps.type}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{bayiHome.managed}" id="bayiGpses">
        <div class="actionButtons">
            <s:button id="addbayiGps"
                   value="Add bayiGps"
                    view="/BayiGpsEdit.xhtml"
             propagation="none">
                 <f:param name="bayiId"
                         value="#{bayiHome.instance.id}"/>
                 <f:param name="bayiGpsFrom" value="Bayi"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
